<%-- 
    Document   : communities
    Created on : Oct 1, 2010, 4:51:01 PM
    Author     : gsagy
--%>


<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib  uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@page import="java.util.ArrayList, model.RegisteredProfiles, model.Profile, model.User" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhmtl1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

    <!-- head section -->
    <head>
        <meta name="author" content="Guy Sagy" />
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <link href="resources/company_icon_32x32.ico" rel="shortcut icon" type="image/ico" />
        <link href="css/${presentationMedium}/main.css" rel="stylesheet" type="text/css" />
        <link href="css/${presentationMedium}/menubar.css" rel="stylesheet" type="text/css" />
        <link href="css/${presentationMedium}/formlayout.css" rel="stylesheet" type="text/css" />
        <script src="js/3rdpartylibs/jslib_dom_ready.js" type="text/javascript"></script>
        <script src="js/3rdpartylibs/jslib_css.js" type="text/javascript"></script>
        <script src="js/3rdpartylibs/jslib_event.js" type="text/javascript"></script>
        <script src="js/3rdpartylibs/jslib_event_mouse.js" type="text/javascript"></script>
        <script src="js/3rdpartylibs/jslib_event_keyboard.js" type="text/javascript"></script>
        <script src="js/button_handlers.js" type="text/javascript"></script>
        <script src="js/menubar.js" type="text/javascript"></script>
        <title>${appTitle} - ${pageTitle}</title>
    </head>

    <body>

        <!-- body header section -->
        <div id="captionBar">
            <h1>${appTitle} - Welcome ${user.profile.firstName} ${user.profile.lastName}</h1>
        </div>

        <%@ include file="WEB-INF/jspf/new_mainmenu.jspf" %>

        <!-- body main section -->
        <div id="main">
            <h1 align="center">${pageTitle}</h1>
            <c:choose>
                <c:when test="${param.mode == 'view'}" >
                    <p align="center">${communitiesHtmlTable}</p>
                    <br/>
                    <c:if test="${communitiesHtmlTable == null}">
                        <p align="center">There are no available communities:</p>
                    </c:if>
                    <table align="center">
                        <tr>
                            <td abbr="center" valign="center">
                                <form action="<%= response.encodeURL("Communities") %>" method="post">
                                    <input type="hidden" name="mode" value="create" />
                                    <input type="submit" value="Create a community" />
                                </form >
                            </td>
                        </tr>
                    </table>
                    <br/>
                </c:when>
                <c:when test="${param.mode == 'create'}" >
                    <p align="center">
                    Please enter the details of the community you want to create:
                    </p>
                    <form action="<%= response.encodeURL("Communities") %>" method="post">
                        <input type="hidden" name="mode" value="docreate" />
                        <table align="center">
                            <tr>
                                <th align="right"><label for="name">Name:</label></th>
                                <td><input type="text" name="name" id="name"/></td>
                            </tr>
                            <tr>
                                <th align="right"><label for="description">Description:</label></th>
                                <td><input type="text" name="description" id="description" /></td>
                            </tr>
                            <tr>
                                <th>&nbsp;</th>
                                <td>&nbsp;</td>
                            </tr>
                            <tr>
                                <th>&nbsp;</th>
                                <td align="center"><input type="submit" value="Create" /></td>
                            </tr>
                        </table>
                    </form>
                    <br/>
                </c:when>
            </c:choose>
        </div>

        <!-- body footer section -->
        <%@include file="WEB-INF/jspf/footer.jspf" %>
            
    </body>

</html>
